﻿using EM.OA.BLL;
using EM.OA.DataModel.DBModel;
using EM.OA.WebCommon.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
namespace EM.OA.Portal.Models
{
	public class SystemFunctionModels : BaseViewModel
	{
      		/// <summary>
		/// ID
        	/// </summary>		
		[Display(Name = "ID")]
        	public Guid FunctionID { get; set; }        
			/// <summary>
		/// 父级
        	/// </summary>		
		[Display(Name = "父级")]
        	public Guid FunctionParentID { get; set; }        
			/// <summary>
		/// 功能名称
        	/// </summary>		
		[Display(Name = "功能名称")]
        	public string FunctionName { get; set; }        
			/// <summary>
		/// 功能对应地址
        	/// </summary>		
		[Display(Name = "功能对应地址")]
        	public string FunctionUrl { get; set; }        
			/// <summary>
		/// 功能描述
        	/// </summary>		
		[Display(Name = "功能描述")]
        	public string FunctionDescription { get; set; }        
			/// <summary>
		/// 排序
        	/// </summary>		
		[Display(Name = "排序")]
        	public int Sort { get; set; }


        /// <summary>
        /// 获取页面列表
        /// </summary>
        /// <param name="dropdownListType"></param>
        /// <returns></returns>
        public virtual IEnumerable<SelectListItem> GetPageListItems(string PageName=null)
        {
            List<SelectListItem> items = new List<SelectListItem>();
            SystemPageBLL bll = new SystemPageBLL();
            List<EMOA_SystemPage> list = bll.GetList(p=>(PageName.IsNullOrEmpty() || p.PageName.Contains(PageName)));
            list.ForEach(p =>
            {
                items.Add(new SelectListItem
                {
                    Text = p.PageName,
                    Value = p.PageID.ToString()
                });
            });
            return items;
        }
		   
	}
}